/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package info.decisionnelle;

import javax.swing.JComboBox;
import javax.swing.JSpinner;

/**
 * 
 * @author Administrateur
 */
public class SimulateurDeClient extends javax.swing.JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Creates new form SimulateurDeClient
	 */
	public SimulateurDeClient() {
		initComponents();

		jComboBoxPurpose.addItem("other");
		jComboBoxPurpose.addItem("new car");
		jComboBoxPurpose.addItem("used car");
		jComboBoxPurpose.addItem("furniture/equipment");
		jComboBoxPurpose.addItem("radio/tv");
		jComboBoxPurpose.addItem("domestic appliance");
		jComboBoxPurpose.addItem("repairs");
		jComboBoxPurpose.addItem("education");
		jComboBoxPurpose.addItem("vacation");
		jComboBoxPurpose.addItem("retraining");
		jComboBoxPurpose.addItem("business");

		jComboBoxChecking.addItem("no checking");
		jComboBoxChecking.addItem("<0");
		jComboBoxChecking.addItem("0<=X<200");
		jComboBoxChecking.addItem(">=200");

		jComboBoxCreditHistory.addItem("no credits/all paid");
		jComboBoxCreditHistory.addItem("all paid");
		jComboBoxCreditHistory.addItem("existing paid");
		jComboBoxCreditHistory.addItem("delayed previously");
		jComboBoxCreditHistory.addItem("critical/other existing credit");

		jComboBoxSavingStatus.addItem("no known savings");
		jComboBoxSavingStatus.addItem("<100");
		jComboBoxSavingStatus.addItem("100<=X<500");
		jComboBoxSavingStatus.addItem("500<=X<1000");
		jComboBoxSavingStatus.addItem(">=1000");

		jComboBoxEmployment.addItem("unemployed");
		jComboBoxEmployment.addItem("<1");
		jComboBoxEmployment.addItem("1<=X<4");
		jComboBoxEmployment.addItem("4<=X<7");
		jComboBoxEmployment.addItem(">=7");

		jComboBoxPersonalStatus.addItem("male div/sep");
		jComboBoxPersonalStatus.addItem("female div/dep/mar");
		jComboBoxPersonalStatus.addItem("male single");
		jComboBoxPersonalStatus.addItem("male mar/wid");
		jComboBoxPersonalStatus.addItem("female single");

		jComboBoxOtherParties.addItem("none");
		jComboBoxOtherParties.addItem("co applicant");
		jComboBoxOtherParties.addItem("guarantor");

		jComboBoxPropertyMagnitude.addItem("no known property");
		jComboBoxPropertyMagnitude.addItem("real estate");
		jComboBoxPropertyMagnitude.addItem("life insurance");
		jComboBoxPropertyMagnitude.addItem("car");

		jComboBoxOtherPaymentPlan.addItem("none");
		jComboBoxOtherPaymentPlan.addItem("bank");
		jComboBoxOtherPaymentPlan.addItem("stores");

		jComboBoxHousing.addItem("own");
		jComboBoxHousing.addItem("rent");
		jComboBoxHousing.addItem("for free");

		jComboBoxQualification.addItem("unemp/unskilled non res");
		jComboBoxQualification.addItem("unskilled resident");
		jComboBoxQualification.addItem("skilled");
		jComboBoxQualification.addItem("high qualif/self emp/mgmt");

		jComboBoxOwnTelephone.addItem("none");
		jComboBoxOwnTelephone.addItem("yes");

		jComboBoxForeignWorker.addItem("no");
		jComboBoxForeignWorker.addItem("yes");
	}

	public int getValueFromSpinner(JSpinner spinner) {
		return Integer.valueOf(spinner.getValue().toString());
	}

	public String getTextFromComboBox(JComboBox<String> liste) {
		return liste.getSelectedItem().toString();
	}

	public int getDuration() {
		return getValueFromSpinner(jSpinnerDureeCredit);
	}

	public int getCredit_amount() {
		return getValueFromSpinner(jSpinnerValeurCredit);
	}

	public int getAge() {
		return getValueFromSpinner(jSpinnerAge);
	}

	public int getResidence_Since() {
		return getValueFromSpinner(jSpinnerResidentSince);
	}

	public int getExisting_credits() {
		return getValueFromSpinner(jSpinnerCreditExistant);
	}

	public int getNum_dependents() {
		return getValueFromSpinner(jSpinnerNumDependents);
	}

	public int getInstallment_commitment() {
		return getValueFromSpinner(jSpinnerMensualiteSouhaiter);
	}

	public String getChecking_status() {
		return getTextFromComboBox(jComboBoxChecking);
	}

	public String getCredit_history() {
		return getTextFromComboBox(jComboBoxCreditHistory);
	}

	public String getPurpose() {
		return getTextFromComboBox(jComboBoxPurpose);
	}

	public String getSavings_status() {
		return getTextFromComboBox(jComboBoxSavingStatus);
	}

	public String getEmployment() {
		return getTextFromComboBox(jComboBoxEmployment);
	}

	public String getPersonal_status() {
		return getTextFromComboBox(jComboBoxPersonalStatus);
	}

	public String getOther_parties() {
		return getTextFromComboBox(jComboBoxOtherParties);
	}

	public String getProperty_magnitude() {
		return getTextFromComboBox(jComboBoxPropertyMagnitude);
	}

	public String getOther_payment_plans() {
		return getTextFromComboBox(jComboBoxOtherPaymentPlan);
	}

	public String getJob() {
		return getTextFromComboBox(jComboBoxQualification);
	}

	public String getOwn_telephone() {
		return getTextFromComboBox(jComboBoxOwnTelephone);
	}

	public String getForeign_worker() {
		return getTextFromComboBox(jComboBoxForeignWorker);
	}

	public String getHousing() {
		return getTextFromComboBox(jComboBoxHousing);
	}

	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		jLabel1 = new javax.swing.JLabel();
		jLabel2 = new javax.swing.JLabel();
		jSpinnerDureeCredit = new javax.swing.JSpinner();
		jLabel3 = new javax.swing.JLabel();
		jLabel4 = new javax.swing.JLabel();
		jComboBoxPurpose = new JComboBox<String>();
		jComboBoxChecking = new JComboBox<String>();
		jComboBoxCreditHistory = new JComboBox<String>();
		jSpinnerValeurCredit = new javax.swing.JSpinner();
		jLabel5 = new javax.swing.JLabel();
		jComboBoxSavingStatus = new JComboBox<String>();
		jLabel6 = new javax.swing.JLabel();
		jLabel7 = new javax.swing.JLabel();
		jComboBoxEmployment = new JComboBox<String>();
		jSpinnerMensualiteSouhaiter = new javax.swing.JSpinner();
		jLabel8 = new javax.swing.JLabel();
		jComboBoxPersonalStatus = new JComboBox<String>();
		jLabel9 = new javax.swing.JLabel();
		jComboBoxOtherParties = new JComboBox<String>();
		jLabel10 = new javax.swing.JLabel();
		jSpinnerResidentSince = new javax.swing.JSpinner();
		jLabel11 = new javax.swing.JLabel();
		jComboBoxPropertyMagnitude = new JComboBox<String>();
		jLabel12 = new javax.swing.JLabel();
		jSpinnerAge = new javax.swing.JSpinner();
		jLabel13 = new javax.swing.JLabel();
		jComboBoxOtherPaymentPlan = new JComboBox<String>();
		jLabel14 = new javax.swing.JLabel();
		jComboBoxHousing = new JComboBox<String>();
		jLabel15 = new javax.swing.JLabel();
		jSpinnerCreditExistant = new javax.swing.JSpinner();
		jLabel16 = new javax.swing.JLabel();
		jComboBoxQualification = new JComboBox<String>();
		jLabel17 = new javax.swing.JLabel();
		jSpinnerNumDependents = new javax.swing.JSpinner();
		jLabel18 = new javax.swing.JLabel();
		jComboBoxOwnTelephone = new JComboBox<String>();
		jLabel19 = new javax.swing.JLabel();
		jComboBoxForeignWorker = new JComboBox<String>();
		jLabel20 = new javax.swing.JLabel();
		jButton1 = new javax.swing.JButton();
		jLabel21 = new javax.swing.JLabel();
		jLabel22 = new javax.swing.JLabel();
		jProgressBarResultat = new javax.swing.JProgressBar();
		jLabel23 = new javax.swing.JLabel();
		jLabel24 = new javax.swing.JLabel();
		jLabel25 = new javax.swing.JLabel();
		jTextFieldGain = new javax.swing.JTextField();
		jTextFieldPerte = new javax.swing.JTextField();
		jProgressBarBad = new javax.swing.JProgressBar();
		jProgressBarGood = new javax.swing.JProgressBar();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

		jLabel1.setText("checking_status");

		jLabel2.setText("duration");

		jLabel3.setText("credit_history");

		jLabel4.setText("purpose");

		jLabel5.setText("credit_amount");

		jLabel6.setText("savings_status");

		jLabel7.setText("employment");

		jLabel8.setText("installment_commitment");

		jLabel9.setText("personal_status");

		jLabel10.setText("other_parties");

		jLabel11.setText("residence_since");

		jLabel12.setText("property_magnitude");

		jLabel13.setText("age");

		jLabel14.setText("other_payment_plans");

		jLabel15.setText("housing");

		jLabel16.setText("existing_credits");

		jLabel17.setText("job");

		jLabel18.setText("num_dependents");

		jLabel19.setText("own_telephone");

		jLabel20.setText("foreign_worker");

		jButton1.setText("Analyser !");
		jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent evt) {
				analyserClick(evt);
			}
		});

		jLabel21.setText("Good");

		jLabel22.setText("Bad");

		jProgressBarResultat.setMaximum(10000);
		jProgressBarResultat.setString("");
		jProgressBarResultat.setStringPainted(true);

		jLabel23.setText("Estimations");

		jLabel24.setText("Gains :");

		jLabel25.setText("Pertes");

		jTextFieldGain.setEnabled(false);

		jTextFieldPerte.setEnabled(false);

		jProgressBarBad.setString("");
		jProgressBarBad.setStringPainted(true);

		jProgressBarGood.setString("");
		jProgressBarGood.setStringPainted(true);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addGroup(
														layout.createSequentialGroup()
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.LEADING)
																				.addGroup(
																						layout.createSequentialGroup()
																								.addComponent(
																										jLabel23)
																								.addGap(139,
																										139,
																										139)
																								.addComponent(
																										jButton1))
																				.addGroup(
																						layout.createSequentialGroup()
																								.addGroup(
																										layout.createParallelGroup(
																												javax.swing.GroupLayout.Alignment.LEADING,
																												false)
																												.addComponent(
																														jLabel24,
																														javax.swing.GroupLayout.DEFAULT_SIZE,
																														javax.swing.GroupLayout.DEFAULT_SIZE,
																														Short.MAX_VALUE)
																												.addComponent(
																														jLabel25,
																														javax.swing.GroupLayout.DEFAULT_SIZE,
																														javax.swing.GroupLayout.DEFAULT_SIZE,
																														Short.MAX_VALUE))
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addGroup(
																										layout.createParallelGroup(
																												javax.swing.GroupLayout.Alignment.LEADING,
																												false)
																												.addComponent(
																														jTextFieldGain,
																														javax.swing.GroupLayout.DEFAULT_SIZE,
																														246,
																														Short.MAX_VALUE)
																												.addComponent(
																														jTextFieldPerte))
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addGroup(
																										layout.createParallelGroup(
																												javax.swing.GroupLayout.Alignment.LEADING)
																												.addComponent(
																														jProgressBarResultat,
																														javax.swing.GroupLayout.PREFERRED_SIZE,
																														200,
																														javax.swing.GroupLayout.PREFERRED_SIZE)
																												.addGroup(
																														layout.createSequentialGroup()
																																.addGroup(
																																		layout.createParallelGroup(
																																				javax.swing.GroupLayout.Alignment.LEADING,
																																				false)
																																				.addComponent(
																																						jLabel22,
																																						javax.swing.GroupLayout.DEFAULT_SIZE,
																																						javax.swing.GroupLayout.DEFAULT_SIZE,
																																						Short.MAX_VALUE)
																																				.addComponent(
																																						jLabel21,
																																						javax.swing.GroupLayout.PREFERRED_SIZE,
																																						31,
																																						javax.swing.GroupLayout.PREFERRED_SIZE))
																																.addGap(5,
																																		5,
																																		5)
																																.addGroup(
																																		layout.createParallelGroup(
																																				javax.swing.GroupLayout.Alignment.LEADING,
																																				false)
																																				.addComponent(
																																						jProgressBarBad,
																																						javax.swing.GroupLayout.DEFAULT_SIZE,
																																						javax.swing.GroupLayout.DEFAULT_SIZE,
																																						Short.MAX_VALUE)
																																				.addComponent(
																																						jProgressBarGood,
																																						javax.swing.GroupLayout.PREFERRED_SIZE,
																																						javax.swing.GroupLayout.DEFAULT_SIZE,
																																						javax.swing.GroupLayout.PREFERRED_SIZE))))))
																.addGap(0,
																		49,
																		Short.MAX_VALUE))
												.addGroup(
														layout.createSequentialGroup()
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.LEADING)
																				.addGroup(
																						layout.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING,
																								false)
																								.addComponent(
																										jComboBoxPurpose,
																										0,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										Short.MAX_VALUE)
																								.addComponent(
																										jSpinnerMensualiteSouhaiter)
																								.addComponent(
																										jSpinnerValeurCredit)
																								.addComponent(
																										jSpinnerDureeCredit)
																								.addComponent(
																										jLabel5,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										Short.MAX_VALUE)
																								.addComponent(
																										jLabel8,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										164,
																										Short.MAX_VALUE)
																								.addComponent(
																										jLabel4,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										Short.MAX_VALUE))
																				.addComponent(
																						jLabel2,
																						javax.swing.GroupLayout.Alignment.TRAILING,
																						javax.swing.GroupLayout.PREFERRED_SIZE,
																						160,
																						javax.swing.GroupLayout.PREFERRED_SIZE))
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.LEADING,
																				false)
																				.addComponent(
																						jLabel16,
																						javax.swing.GroupLayout.PREFERRED_SIZE,
																						88,
																						javax.swing.GroupLayout.PREFERRED_SIZE)
																				.addComponent(
																						jLabel14,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						135,
																						Short.MAX_VALUE)
																				.addComponent(
																						jComboBoxChecking,
																						0,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jComboBoxCreditHistory,
																						0,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jSpinnerCreditExistant)
																				.addComponent(
																						jSpinnerNumDependents)
																				.addComponent(
																						jLabel18,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jComboBoxOtherParties,
																						0,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jComboBoxOtherPaymentPlan,
																						0,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jLabel10,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jLabel3,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jLabel1,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE))
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.LEADING)
																				.addComponent(
																						jLabel12,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						217,
																						Short.MAX_VALUE)
																				.addComponent(
																						jComboBoxQualification,
																						0,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jComboBoxPersonalStatus,
																						0,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jComboBoxEmployment,
																						0,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jSpinnerResidentSince)
																				.addComponent(
																						jSpinnerAge)
																				.addComponent(
																						jComboBoxSavingStatus,
																						0,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jComboBoxOwnTelephone,
																						0,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jComboBoxHousing,
																						0,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jComboBoxForeignWorker,
																						0,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jLabel17,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jLabel7,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jLabel13,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jLabel11,
																						javax.swing.GroupLayout.Alignment.TRAILING,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jLabel6,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jLabel9,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jComboBoxPropertyMagnitude,
																						0,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jLabel19,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jLabel15,
																						javax.swing.GroupLayout.Alignment.TRAILING,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE)
																				.addComponent(
																						jLabel20,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						Short.MAX_VALUE))
																.addContainerGap()))));
		layout.setVerticalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addGroup(
														layout.createSequentialGroup()
																.addComponent(
																		jLabel5)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addComponent(
																		jSpinnerValeurCredit,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		javax.swing.GroupLayout.DEFAULT_SIZE,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.TRAILING)
																				.addGroup(
																						layout.createSequentialGroup()
																								.addComponent(
																										jLabel8)
																								.addGap(26,
																										26,
																										26))
																				.addComponent(
																						jSpinnerMensualiteSouhaiter,
																						javax.swing.GroupLayout.PREFERRED_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.PREFERRED_SIZE))
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addComponent(
																		jLabel2)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addComponent(
																		jSpinnerDureeCredit,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		javax.swing.GroupLayout.DEFAULT_SIZE,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addComponent(
																		jLabel4)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addComponent(
																		jComboBoxPurpose,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		javax.swing.GroupLayout.DEFAULT_SIZE,
																		javax.swing.GroupLayout.PREFERRED_SIZE))
												.addGroup(
														layout.createSequentialGroup()
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.TRAILING)
																				.addGroup(
																						layout.createSequentialGroup()
																								.addComponent(
																										jLabel17)
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addComponent(
																										jComboBoxQualification,
																										javax.swing.GroupLayout.PREFERRED_SIZE,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										javax.swing.GroupLayout.PREFERRED_SIZE)
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addComponent(
																										jLabel7)
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addComponent(
																										jComboBoxEmployment,
																										javax.swing.GroupLayout.PREFERRED_SIZE,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										javax.swing.GroupLayout.PREFERRED_SIZE))
																				.addGroup(
																						layout.createSequentialGroup()
																								.addComponent(
																										jLabel1)
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addComponent(
																										jComboBoxChecking,
																										javax.swing.GroupLayout.PREFERRED_SIZE,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										javax.swing.GroupLayout.PREFERRED_SIZE)
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addComponent(
																										jLabel3)
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addComponent(
																										jComboBoxCreditHistory,
																										javax.swing.GroupLayout.PREFERRED_SIZE,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										javax.swing.GroupLayout.PREFERRED_SIZE)))
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.LEADING)
																				.addGroup(
																						layout.createSequentialGroup()
																								.addComponent(
																										jLabel13)
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addComponent(
																										jSpinnerAge,
																										javax.swing.GroupLayout.PREFERRED_SIZE,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										javax.swing.GroupLayout.PREFERRED_SIZE))
																				.addGroup(
																						layout.createSequentialGroup()
																								.addComponent(
																										jLabel14)
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addComponent(
																										jComboBoxOtherPaymentPlan,
																										javax.swing.GroupLayout.PREFERRED_SIZE,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										javax.swing.GroupLayout.PREFERRED_SIZE)))
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.TRAILING)
																				.addGroup(
																						javax.swing.GroupLayout.Alignment.LEADING,
																						layout.createSequentialGroup()
																								.addComponent(
																										jLabel10)
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addComponent(
																										jComboBoxOtherParties,
																										javax.swing.GroupLayout.PREFERRED_SIZE,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										javax.swing.GroupLayout.PREFERRED_SIZE))
																				.addGroup(
																						javax.swing.GroupLayout.Alignment.LEADING,
																						layout.createSequentialGroup()
																								.addComponent(
																										jLabel11)
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addComponent(
																										jSpinnerResidentSince,
																										javax.swing.GroupLayout.PREFERRED_SIZE,
																										javax.swing.GroupLayout.DEFAULT_SIZE,
																										javax.swing.GroupLayout.PREFERRED_SIZE)))))
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.TRAILING)
												.addGroup(
														layout.createSequentialGroup()
																.addComponent(
																		jLabel16)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addComponent(
																		jSpinnerCreditExistant,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		javax.swing.GroupLayout.DEFAULT_SIZE,
																		javax.swing.GroupLayout.PREFERRED_SIZE))
												.addGroup(
														layout.createSequentialGroup()
																.addComponent(
																		jLabel6)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addComponent(
																		jComboBoxSavingStatus,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		javax.swing.GroupLayout.DEFAULT_SIZE,
																		javax.swing.GroupLayout.PREFERRED_SIZE)))
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addGroup(
														layout.createSequentialGroup()
																.addComponent(
																		jLabel9)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addComponent(
																		jComboBoxPersonalStatus,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		javax.swing.GroupLayout.DEFAULT_SIZE,
																		javax.swing.GroupLayout.PREFERRED_SIZE))
												.addGroup(
														layout.createSequentialGroup()
																.addComponent(
																		jLabel18)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addComponent(
																		jSpinnerNumDependents,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		javax.swing.GroupLayout.DEFAULT_SIZE,
																		javax.swing.GroupLayout.PREFERRED_SIZE)))
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(jLabel12)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(jComboBoxPropertyMagnitude,
										javax.swing.GroupLayout.PREFERRED_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE,
										javax.swing.GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(jLabel19)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(jComboBoxOwnTelephone,
										javax.swing.GroupLayout.PREFERRED_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE,
										javax.swing.GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(jLabel15)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(jComboBoxHousing,
										javax.swing.GroupLayout.PREFERRED_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE,
										javax.swing.GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(jLabel20)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(jComboBoxForeignWorker,
										javax.swing.GroupLayout.PREFERRED_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE,
										javax.swing.GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(jButton1)
												.addComponent(jLabel23))
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(
														jProgressBarResultat,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														javax.swing.GroupLayout.PREFERRED_SIZE)
												.addComponent(jLabel24)
												.addComponent(
														jTextFieldGain,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														javax.swing.GroupLayout.PREFERRED_SIZE))
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addGroup(
														layout.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
																.addComponent(
																		jLabel25)
																.addComponent(
																		jTextFieldPerte,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		javax.swing.GroupLayout.DEFAULT_SIZE,
																		javax.swing.GroupLayout.PREFERRED_SIZE))
												.addGroup(
														layout.createSequentialGroup()
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.TRAILING)
																				.addComponent(
																						jProgressBarBad,
																						javax.swing.GroupLayout.PREFERRED_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.PREFERRED_SIZE)
																				.addComponent(
																						jLabel22))
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.LEADING)
																				.addComponent(
																						jLabel21)
																				.addComponent(
																						jProgressBarGood,
																						javax.swing.GroupLayout.PREFERRED_SIZE,
																						javax.swing.GroupLayout.DEFAULT_SIZE,
																						javax.swing.GroupLayout.PREFERRED_SIZE))))
								.addContainerGap(
										javax.swing.GroupLayout.DEFAULT_SIZE,
										Short.MAX_VALUE)));

		pack();
	}// </editor-fold>//GEN-END:initComponents

	private void analyserClick(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_analyserClick

		String checking_status = getChecking_status();
		String credit_history = getCredit_history();
		String purpose = getPurpose();
		int credit_amount = getCredit_amount();
		String savings_status = getSavings_status();
		String employment = getEmployment();
		String personal_status = getPersonal_status();
		String other_parties = getOther_parties();
		int residence_since = getResidence_Since();
		String property_magnitude = getProperty_magnitude();
		int installment_commitment = getInstallment_commitment();
		int age = getAge();
		String other_payment_plans = getOther_payment_plans();
		int existing_credits = getExisting_credits();
		int num_dependents = getNum_dependents();
		String job = getJob();
		String own_telephone = getOwn_telephone();
		String foreign_worker = getForeign_worker();
		int duration = getDuration();
		String housing = getHousing();
		DemandeDeCredit demande = new DemandeDeCredit(checking_status,
				credit_history, purpose, credit_amount, savings_status,
				employment, installment_commitment, personal_status,
				other_parties, residence_since, property_magnitude, age,
				other_payment_plans, housing, existing_credits, num_dependents,
				job, own_telephone, foreign_worker, duration);

		// Si good result = 100% - Proba d'erreur
		// Si bad result = 0% + Proba d'erreur

		double result = WekaAnalyzer.analyzeWithWeka(demande);
		double[] distribution = WekaAnalyzer.getDistributionForInstance();

		if (result == 0) // GOOD
		{
			jProgressBarResultat.setValue(10000);
			jProgressBarResultat.setString("Good");
		} else if (result == 1) // BAD
		{
			jProgressBarResultat.setValue(0);
			jProgressBarResultat.setString("Bad");
		} else {
			jProgressBarResultat.setString("Error");
		}

		jTextFieldGain.setText(Double.toString(getCredit_amount() * 0.14));
		jTextFieldPerte.setText(Double.toString(-getCredit_amount() * 0.7));
		jProgressBarGood.setValue((int) (distribution[0] * 100));
		jProgressBarGood
				.setString(Double.toString(distribution[0] * 100) + "%");
		jProgressBarBad.setValue((int) (distribution[1] * 100));
		jProgressBarBad.setString(Double.toString(distribution[1] * 100) + "%");

	}// GEN-LAST:event_analyserClick

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		/* Set the Nimbus look and feel */
		// <editor-fold defaultstate="collapsed"
		// desc=" Look and feel setting code (optional) ">
		/*
		 * If Nimbus (introduced in Java SE 6) is not available, stay with the
		 * default look and feel. For details see
		 * http://download.oracle.com/javase
		 * /tutorial/uiswing/lookandfeel/plaf.html
		 */
		try {
			for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager
					.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					javax.swing.UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (ClassNotFoundException ex) {
			java.util.logging.Logger.getLogger(
					SimulateurDeClient.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (InstantiationException ex) {
			java.util.logging.Logger.getLogger(
					SimulateurDeClient.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (IllegalAccessException ex) {
			java.util.logging.Logger.getLogger(
					SimulateurDeClient.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (javax.swing.UnsupportedLookAndFeelException ex) {
			java.util.logging.Logger.getLogger(
					SimulateurDeClient.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		}
		// </editor-fold>

		/* Create and display the form */
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new SimulateurDeClient().setVisible(true);
			}
		});
	}

	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JButton jButton1;
	private javax.swing.JComboBox<String> jComboBoxChecking;
	private javax.swing.JComboBox<String> jComboBoxCreditHistory;
	private javax.swing.JComboBox<String> jComboBoxEmployment;
	private javax.swing.JComboBox<String> jComboBoxForeignWorker;
	private javax.swing.JComboBox<String> jComboBoxHousing;
	private javax.swing.JComboBox<String> jComboBoxOtherParties;
	private javax.swing.JComboBox<String> jComboBoxOtherPaymentPlan;
	private javax.swing.JComboBox<String> jComboBoxOwnTelephone;
	private javax.swing.JComboBox<String> jComboBoxPersonalStatus;
	private javax.swing.JComboBox<String> jComboBoxPropertyMagnitude;
	private javax.swing.JComboBox<String> jComboBoxPurpose;
	private javax.swing.JComboBox<String> jComboBoxQualification;
	private javax.swing.JComboBox<String> jComboBoxSavingStatus;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel10;
	private javax.swing.JLabel jLabel11;
	private javax.swing.JLabel jLabel12;
	private javax.swing.JLabel jLabel13;
	private javax.swing.JLabel jLabel14;
	private javax.swing.JLabel jLabel15;
	private javax.swing.JLabel jLabel16;
	private javax.swing.JLabel jLabel17;
	private javax.swing.JLabel jLabel18;
	private javax.swing.JLabel jLabel19;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel20;
	private javax.swing.JLabel jLabel21;
	private javax.swing.JLabel jLabel22;
	private javax.swing.JLabel jLabel23;
	private javax.swing.JLabel jLabel24;
	private javax.swing.JLabel jLabel25;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JLabel jLabel4;
	private javax.swing.JLabel jLabel5;
	private javax.swing.JLabel jLabel6;
	private javax.swing.JLabel jLabel7;
	private javax.swing.JLabel jLabel8;
	private javax.swing.JLabel jLabel9;
	private javax.swing.JProgressBar jProgressBarBad;
	private javax.swing.JProgressBar jProgressBarGood;
	private javax.swing.JProgressBar jProgressBarResultat;
	private javax.swing.JSpinner jSpinnerAge;
	private javax.swing.JSpinner jSpinnerCreditExistant;
	private javax.swing.JSpinner jSpinnerDureeCredit;
	private javax.swing.JSpinner jSpinnerMensualiteSouhaiter;
	private javax.swing.JSpinner jSpinnerNumDependents;
	private javax.swing.JSpinner jSpinnerResidentSince;
	private javax.swing.JSpinner jSpinnerValeurCredit;
	private javax.swing.JTextField jTextFieldGain;
	private javax.swing.JTextField jTextFieldPerte;
	// End of variables declaration//GEN-END:variables
}
